﻿using System.Text;

namespace Decorator
{
    public class StringDisplay : Display
    {
        private string str;

        public StringDisplay(string str)
        {
            this.str = str;
        }

        public override int GetColumns()
        {
            Encoding enc = Encoding.GetEncoding("shift_jis");
            return enc.GetByteCount(str);
        }

        public override int GetRows()
        {
            return 1;
        }

        public override string GetRowText(int row)
        {
            return ((row == 0) ? str : null);
        }
    }
}
